package eu.cogen;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import eu.AppContext;
import eu.cogen.conf.Config;
import eu.common.toolkits.ResourceUtil;
import eu.template.TemplateContext;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		AppContext.putConfig("app_root", ResourceUtil.root);
		AppContext.loadConfig();
		TemplateContext.initContext();
	}

	public static List<String> scanProjects() {
		List<String> prjs = new ArrayList<String>();
		File dir = new File(Config.getProjectsDir());
		for (File file : dir.listFiles()) {
			if (file.isDirectory() && new File(file.getAbsolutePath()+"/project.xml").exists()) {
				prjs.add(dir.getName());
			}
		}
		return prjs;
	}
}
